package com.demo.spring;

import org.aopalliance.intercept.Joinpoint;
import org.apache.log4j.Logger;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;

public class ErrorLogger {
    private static final Logger log = Logger.getLogger(ErrorLogger.class);
    public void afterThrowing(JoinPoint jp,RuntimeException e){
        log.error(jp.getSignature().getName()+" 方法发生异常:" + e);
    }

    public Object aroundLogger(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
        Joinpoint pjp = null;
        return pjp.proceed();
    }

    public void afterLogger(JoinPoint joinPoint) throws Throwable {
    }
}
